package com.huifaapp.mall.selectImage;

import com.google.gson.Gson;

import java.io.Serializable;

/**
 * Created by chen on 2017/6/21.
 */

public class ImagePath implements Serializable {
    int type;
    String url;
    int isHttp;
    int id;
    int width;
    int height;
    int is_gif;

    String local_path;

    public static final int IMAGE = 1;
    public static final int VEDIO = 2;

    public String getLocal_path() {
        return local_path;
    }

    public void setLocal_path(String local_path) {
        this.local_path = local_path;
    }

    public int getIs_gif() {
        return is_gif;
    }

    public void setIs_gif(int is_gif) {
        this.is_gif = is_gif;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getType() {
        return IMAGE;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getIsHttp() {
        return isHttp;
    }

    public void setIsHttp(int isHttp) {
        this.isHttp = isHttp;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public static String tojson(ImagePath account){
        if(account == null){
            return "";
        }
        Gson gson = new Gson();
        return gson.toJson(account);
    }

    public static ImagePath toImagePath(String json){
        Gson gson = new Gson();
        try {
            return gson.fromJson(json, ImagePath.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public String toString() {
        return "ImagePath{" +
                "type=" + type +
                ", url='" + url + '\'' +
                ", isHttp=" + isHttp +
                ", id=" + id +
                ", width=" + width +
                ", height=" + height +
                ", is_gif=" + is_gif +
                '}';
    }
}
